/*
 * @Author: bankeyu-dell 573569790@qq.com
 * @Date: 2022-10-08 15:53:59
 * @LastEditors: bankeyu-dell 573569790@qq.com
 * @LastEditTime: 2022-10-13 00:09:37
 * @FilePath: \fast-vue3\src\api\customer\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { get, post } from '/@/utils/http/axios';
enum URL {
  register = '/unverify/register', // 注册
  passLogon = '/unverify/pass-logon', // 密码登录
  sendVerifyCode = '/unverify/send-verifyCode', // 发送验证码
  setpass = '/unverify/setpass', // 设置密码
  verifyCodeLogon = '/unverify/verify-codeLogon', // 验证码登陆
  verifyCustomer = '/unverify/verifyCustomer', // 获取用户信息
  wxlogon = '/unverify/wx-logon', // 微信登陆
  encounterFlag = '/msvc/encounter/flag', // 设置随遇的开关
  logout = '/msvc/logout', // 登出接口
  updatecustomer = '/msvc/updatecustomer', // 更新用户信息接口
  updateportrait = '/msvc/updateportrait', // 更新头像接口
}

export interface PassLoginData {
  username: string;
  password: string;
}

export interface RegisterData {
  birthday: string;
  email: string;
  gender: string;
  mobile: string;
  nation: string;
  serialNo: string;
  uuid: string;
}

export interface SendVerifyCodeData {
  code: string;
  email: string;
  serialNo: string;
  mobile: string;
  testFlag: string;
  type: string;
}

export interface SetpassData {
  confirmpass: string;
  pass: string;
  random: string;
  timestamp: string;
  username: string;
  uuid: string;
}

export interface VerifyCodeLogonData {
  code: string;
  email: string;
  serialNo: string;
  mobile: string;
  testFlag: string;
  type: string;
}

export interface VerifyCustomerData {
  nation: string;
  pushToken: string;
  serialNo: string;
}

export interface WxlogonData {
  code: string;
  serialNo: string;
}

export interface EncounterFlagData {
  customerId: number;
  encounterFlag: string;
}

export interface UpdatecustomerData {
  birthday: string;
  code: string;
  customerId: number;
  customerName: string;
  email: string;
  encounterFlag: string;
  mobile: string;
  nation: string;
  nationFlag: string;
}

export interface IdData {
  id: number;
}

const passLogon = async (data: PassLoginData) => post<any>({ url: URL.passLogon, data });
const register = async (data: RegisterData) => post<any>({ url: URL.register, data });
const sendVerifyCode = async (data: SendVerifyCodeData) => post<any>({ url: URL.sendVerifyCode, data });
const setpass = async (data: SetpassData) => post<any>({ url: URL.setpass, data });
const verifyCodeLogon = async (data: VerifyCodeLogonData) => post<any>({ url: URL.verifyCodeLogon, data });
const verifyCustomer = async (data: VerifyCustomerData) => post<any>({ url: URL.verifyCustomer, data });
const wxlogon = async (data: WxlogonData) => post<any>({ url: URL.wxlogon, data });
const encounterFlag = async (data: EncounterFlagData) => post<any>({ url: URL.encounterFlag, data });
const logout = async () => get<any>({ url: URL.logout });
const updatecustomer = async (data: UpdatecustomerData) => post<any>({ url: URL.updatecustomer, data });
const updateportrait = async (data: IdData) => post<any>({ url: URL.updateportrait, data });
export {
  passLogon,
  register,
  sendVerifyCode,
  setpass,
  verifyCodeLogon,
  verifyCustomer,
  wxlogon,
  encounterFlag,
  logout,
  updatecustomer,
  updateportrait,
};
